--add an popup before trading money, and before doing gleader
if GetLocale()=="zhCN" then
	BF_TRADEMONEY_CONFIRMATION="确定要将下列金额交易给%s吗？"
elseif GetLocale()=="zhTW" then
	BF_TRADEMONEY_CONFIRMATION="確定要將下列金額交易給%s嗎？"
else
	BF_TRADEMONEY_CONFIRMATION="Will trade the follow amount of gold to %s, continue?"

end

local BF_GLeader_Ori=SlashCmdList["GUILD_LEADER"]
BFSecure_MoneyAmount = 1000000

StaticPopupDialogs["BF_TRADE_MONEY"] = {
	text = BF_TRADEMONEY_CONFIRMATION,
	button1 = ACCEPT,
	button2 = CANCEL,
	OnAccept = function(self)
		AcceptTrade()
	end,
	OnCancel = function(self)
	end,
	OnShow = function(self)
		MoneyFrame_Update(self.moneyFrame, MoneyInputFrame_GetCopper(TradePlayerInputMoneyFrame));
	end,
	hasMoneyFrame = 1,
	timeout = 0,
	hideOnEscape = 1
};

function BFSecureToggleTrade(toggle)
	if toggle then
		TradeFrameTradeButton:SetScript("OnClick",function()
			local copper=MoneyInputFrame_GetCopper(TradePlayerInputMoneyFrame);
			if copper>=BFSecure_MoneyAmount then-- if copper >100G
				StaticPopup_Show("BF_TRADE_MONEY",UnitName("NPC"));
			else
				AcceptTrade()
			end
		end)
	else
		TradeFrameTradeButton:SetScript("OnClick",AcceptTrade)
	end
end

function BFGLeaderFunc(msg)
	if( msg and (strlen(msg) > MAX_CHARACTER_NAME_BYTES) ) then
		ChatFrame_DisplayUsageError(ERR_NAME_TOO_LONG2);
		return;
	end
	if strlen(msg)>0 then
		StaticPopup_Show("CONFIRM_GUILD_PROMOTE", msg)
	elseif 	UnitName("target") then
		StaticPopup_Show("CONFIRM_GUILD_PROMOTE", UnitName("target"))
	end
end

function BFSecureToggleGLeader(toggle)
	if toggle then
		SlashCmdList["GUILD_LEADER"] = BFGLeaderFunc
	else
		SlashCmdList["GUILD_LEADER"]=BF_GLeader_Ori
	end
	
end
BFSecureToggleGLeader(true)
BFSecureToggleTrade(true)